package com.kongchengji.spider.util;

import com.kongchengji.spider.station.constant.Constant;

import java.util.ArrayList;

public class ManageImgSrcUtil {

    /**
     * 需特殊处理的图片链接
     * @param station 爬取的站点
     * @param urlContentList 图片链接集合
     * @return
     */
    public static ArrayList<String> manageImgSrc(Constant.Station station, ArrayList<String> urlContentList){
        ArrayList<String> newList = new ArrayList<>();
        if(station.getId() == 28){
            for(String url:urlContentList){
                url = "http://qq.yh31.com" + url;
                newList.add(url);
            }
        }else if(station.getId() == 21 ){
            for(String url:urlContentList){
                url = "https:" + url;
                newList.add(url);
            }
        }else {
            newList.addAll(urlContentList);
        }
        return newList;
    }

    public static String manageThumbnail(Constant.Station station,String url){
        if(station.getId() == 28){
            url = "http://qq.yh31.com" + url;
        }else if(station.getId() == 21 ){
            url = "https:" + url;
        }
        return url;
    }
}
